<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>登录验证</title>
  </head>
  <script type="text/javascript">
  function validate(f){
  	if(!(/^\w{5,15}$/.test(f.userid.value))){
  	alert("用户ID必须是5~15位！");
  	f.userid.focus();
  	validate();
  	return false;
  	}
  	if(!(/^\w{5,15}$/.test(f.userpass.value))){
  	alert("密码必须是5~15位！");
  	f.userpass.focus();
  	return false;
  	}
  }
  function change(){
  	var code=document.getElementById("codeimg");
  	code.src="servlet/ServletCode?"+new Date();
  	}
   </script>
   <%
  request.setCharacterEncoding("utf-8");
  %>
  <%
  	List<String>info=(List<String>)
  	request.getAttribute("info");
  	if(info!=null){
  	Iterator<String>iter=info.iterator();
  	while(iter.hasNext()){
  	 %>
  	 <h4><%=iter.next()%></h4>
  	<%
  	}
  	 }
  %>
  <body>
 	<form action="LoginServlet" method="post" onsubmit="return validate(this)">
 	<table boder="1" align="center">
 	<tr>
 	<td>用户名</td>
 	<td><input type="text" name="userid"/></td>
 	</tr>
 	<tr>
 	<td>密码</td>
 	<td><input type="password" name="userpass"/></td>
 	</tr>
 	<tr>
 	<td>验证码</td>
 	<td><input type="text" size="10" name="Valcode"/>
 	<img id="codeimg" src="servlet/ServletCode" onclick="change()" title="看不清，换一张"/>
 	</td>
 	</tr>
 	<tr>
 	<td colspan="1" align="center"><input type="submit" value="登录" onclick="validate()"/></td>
 	<td colspan="1" align="center"><input type="reset" value="重置"/></td>
 	</tr>
 	</table>
 	
 	</form>
  </body>
</html>
更多 0